<template>
  <el-dialog v-model="dialogVisible" :title="$t('common.userinfo')" width="800" draggable>
    <el-card class="box-card">
      <template #header>
        <el-descriptions class="margin-top" :column="1" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon :style="iconStyle">
                  <user />
                </el-icon>
                {{ $t("system.account.username") }}
              </div>
            </template>
            {{ userStore.userInfo.name }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon :style="iconStyle">
                  <user />
                </el-icon>
                {{ $t("system.branch.name") }}
              </div>
            </template>
            {{ userStore.userInfo.branch_name }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon :style="iconStyle">
                  <user />
                </el-icon>
                {{ $t("system.staff.job_no") }}
              </div>
            </template>
            {{ userStore.userInfo.job_no }}
          </el-descriptions-item>
        </el-descriptions>
      </template>
    </el-card>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useUserStore } from "@/stores/modules/user";

const userStore = useUserStore();
const dialogVisible = ref(false);
const openDialog = () => {
  dialogVisible.value = true;
};

defineExpose({ openDialog });
</script>
